import { createStore, applyMiddleware } from 'redux'
import { thunk } from 'redux-thunk'
import { composeWithDevTools } from '@redux-devtools/extension'

const initState = {
  num: 100,
  name: 'aaaa'
}

const reducer = (state = initState, { type, payload }) => {
  if ('add' == type) return { ...state, num: state.num + payload }
  return state
}

export default createStore(reducer, composeWithDevTools(applyMiddleware(thunk)))
